<?php 
namespace wsys;

class Hook {

    public static function on($action, $params = [], $theme = WSYS_THEME)
    {
        $path = \preg_replace("/::|\/|\\|:/", DS, $action);

        include_once(APP_PATH . DS . "behavior" . DS . $theme . DS . $path . '.php');

        $class = "\\wsys\\behavior\\" . $theme . "\\" . $path;

        try {
            return $class();
        } catch (\Throwable $th) {
            return false;
        }

    }

}